package com.rayc.test;

import org.junit.Test;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;

public class PoolDemo {


    //简单方式
    @Test
    public void pool(){
        //1.创建连接池
        JedisPool pool = new JedisPool("192.168.232.128",6379);
        //2.通过连接池获取jedis对象
        Jedis jedis = pool.getResource();
        //3.操作
        String value = jedis.get("name");
        System.out.println(value);
        //4.释放资源
        jedis.close();;
    }
}
